package cn.yunhe.service;

import cn.yunhe.dao.IBoardDao;
import cn.yunhe.pojo.BoardDemo;
import cn.yunhe.sqlsessionutil.SqlSessionUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class BoardService {
    SqlSession session = SqlSessionUtil.getSqlSession();
    IBoardDao boardDao = session.getMapper(IBoardDao.class);
    public int addBoard(BoardDemo boardemo){
      int result =  boardDao.addBoardByBoard(boardemo);
      session.commit();
      return  result;
    }

    public List<BoardDemo> searchAllBoard(){
        return  boardDao.searchAllBoards();
    }
}
